import AppError from "@/shared/app-error";
import _ from "lodash";

export function checkPageAndSize(page: number, size: number) {
  if (!_.isInteger(page) || page < 1) {
    throw new AppError({ code: "ERR_BAD_PAGE_OR_SIZE", message: "参数 page 不正确" });
  }
  if (!_.isInteger(size) || size < 1 || size > 100) {
    throw new AppError({ code: "ERR_BAD_PAGE_OR_SIZE", message: "参数 size 不正确" });
  }
}
